package com.huazh.controller;

import com.huazh.bean.User;
import com.huazh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Authoe: hzh
 * @Time: 2020/7/3111:53
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("add")
    public void add( Long accountId, String userName){
        User user = new User();
        user.setId((long)(1+Math.random()*1000));
        user.setAccountId(accountId);
        user.setUserName(userName);
        try {
            userService.add(user);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
